benchmark: add benchmark for buf.compare()#5441
Closed
Trott wants to merge 3 commits intonodejs:masterfrom
Closed
Conversation
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead.
| var b1 = new Buffer(size).fill('a'); | ||
|
|
||
| b1[size - 1] = 'b'.charCodeAt(0); | ||
|
|
Contributor
There was a problem hiding this comment.
Please insert code to force optimization of b0.compare before starting the benchmark. Take a look at some of the other (e.g. path) benchmarks to see how to do this.
Member
Author
|
Contributor
|
LGTM |
| b1[size - 1] = 'b'.charCodeAt(0); | ||
|
|
||
| // Force optimization before starting the benchmark | ||
| b0.compare(b0, b1); |
Contributor
There was a problem hiding this comment.
This and the other instance below should instead be b0.compare(b1);
Member
Author
|
Contributor
|
LGTM |
Member
Author
Trott
added a commit
to Trott/io.js
that referenced
this pull request
Feb 28, 2016
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: nodejs#5441 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com>
Member
Author
|
Landed in ffdc046 |
Fishrock123
pushed a commit
that referenced
this pull request
Mar 2, 2016
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com>
MylesBorins
pushed a commit
that referenced
this pull request
Mar 17, 2016
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com>
MylesBorins
pushed a commit
that referenced
this pull request
Mar 21, 2016
There is a benchmark for the class method `Buffer.compare()` but not for the instance method `buf.compare()`. This adds that benchmark. I used this to confirm a performance regression in an implementation I was considering. While the implementation was a bust, it does seem like the benchmark is worthwhile. The benchmark is nearly identical to the existing `Buffer.compare()` benchmark except, of course, that it calls `buf.compare()` instead. PR-URL: #5441 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Evan Lucas <evanlucas@me.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There is a benchmark for the class method
Buffer.compare()but not forthe instance method
buf.compare(). This adds that benchmark.I used this to confirm a performance regression in an implementation I
was considering. While the implementation was a bust, it does seem like
the benchmark is worthwhile.
The benchmark is nearly identical to the existing
Buffer.compare()benchmark except, of course, that it calls
buf.compare()instead.